import java.io.Serializable;

/**
 * 
 * @author Group 03, NETWORK COMUNICATION COMPONENT, SOFTWARE ENGINEERING I, 2012-2013.
 * 
 * Messages sent from the server to clients. A message contains a type (enum), a payload (String), 
 * and a sender (String). 
 *
 */

public class MessageToClient implements ClientSideMessage, Serializable{

	
	private Type typeOfMessage;
	private String payload;
	private String sendersNickname;
	
	public MessageToClient(Type typeOfMessage, String payload, String sendersNickname) {
		this.typeOfMessage = typeOfMessage;
		this.payload = payload;
		this.sendersNickname = sendersNickname;
	}

	
	/**
	 * Gets the type of the message.
	 * 
	 * @return type of the message.
	 */
	@Override
	public Type getType() {
		return typeOfMessage;
	}

	
	/**
	 * Gets the payload of the message.
	 * 
	 * @return payload.
	 */
	@Override
	public String getPayload() {
		return payload;
	}

	
	/**
	 * Gets the sender of the message. The sender is the nickname of the message sender in case the message sent is 
	 * a Birdsong message from one client to another. For all other messages. The sender will be SERVER.
	 * 
	 * @return sender of the message.
	 */
	@Override
	public String getSendersNickname() {
		return sendersNickname;
	}
}
